home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / mike40c.arc / PUTSCA.ASM < prev    next >
Assembly Source File  |  1986-10-24  |  4KB  |  89 lines

  1. page ,132
  2.         title    putsca.asm - no snow screen update routine
  3.  
  4. ;****************************************************************
  5. ;* No-snow screen display routine                               *
  6. ;*  This routine moves screen attributes to a buffer on the     *
  7. ;*  current screen during horizontal retrace time, resulting in *
  8. ;*  no screen flicker.                                          *
  9. ;*                                                              *
  10. ;* definition:                                                  *
  11. ;*    void putsca (unsigned , int, int, int);                   *
  12. ;*      unsigned int attrib   /* attribute                      *
  13. ;*      int start_of_buff     /* row*80 + col                   *
  14. ;*      int length            /* # of col                       *
  15. ;*      int page              /* video page                     *
  16. ;*                                                              *
  17. ;* note: designed for use with Microsoft 'C' (4.0)              *
  18. ;*                                                              *
  19. ;* edit date: 10/19/86         by Mike Elkins                   *
  20. ;****************************************************************
  21.  
  22. _text       segment    byte public 'code'
  23.             assume     cs:_text
  24.  
  25.             public     _putsca
  26. _putsca        proc    near
  27.  
  28. ; attrib = +6
  29. ; offset = +8
  30. ; length = +10
  31.  
  32.                 push    bp                      ;save calling environment
  33.                 mov     bp,sp
  34.                 push    si
  35.                 push    di
  36.                 push    ds
  37.  
  38.           mov    ah,15            ;get current mode
  39.            int    10h            ;system video
  40.               mov    dx,3BAh            ;monochrome port address
  41.                 mov     di,[bp+6]               ;offset for attribute
  42.                 add     di,di                   ;correct for attribute bytes
  43.            cmp    al,7            ;is b/w?
  44.             je    movmno                  ;skip pages for mono
  45.                 mov     dx,3DAh                 ;color port
  46.                 mov     ax,0B800h               ;color page 0
  47.                 mov     bx,[bp+10]              ;get page
  48.                 cmp     bx,0
  49.                 je      mov001                  ;page 0
  50.                 mov     ax,0B900h
  51.                 cmp     bx,1
  52.                 je      mov001                  ;page 1
  53.                 mov     ax,0BA00h
  54.                 cmp     bx,2
  55.                 je      mov001                  ;page 2
  56.                 mov     ax,0BB00h               ;page 3
  57.                 jmp     mov001                  ;skip past mono stuff
  58.  
  59. movmno:         mov     ax,0B000h                ;set for mono address
  60. mov001:         add     di,1                    ;set to attribute byte
  61.                 mov     es,ax
  62.  
  63.                 mov     cx,[bp+8]               ;block length
  64.  
  65. mov002:
  66.                 in      al,dx                   ;screen status
  67.                 test    al,1                    ;is 'high'?
  68.                 jnz     mov002                  ;yes - wait
  69. mov004:         in      al,dx                   ;screen status
  70.                 test    al,1                    ;is 'low'?
  71.                 jz      mov004                  ;yes - wait
  72.                 mov     ax,[bp+4]
  73.                 mov     es:[di],al              ;mov byte to screen
  74.                 add     di,2                    ;every other one
  75.                 loop    mov002
  76.  
  77.                 pop    ds
  78.                 pop    di
  79.                 pop    si
  80.                 pop    bp
  81.                 ret
  82.  
  83. _putsca         endp
  84.  
  85. _text           ends
  86.  
  87.                 end
  88. 
  89.